
//EVENTO DE SOLO NUMERO EN INPUTS TEXT
function soloNumeros(evt){
	var keyPressed = (evt.which) ? evt.which : event.keyCode
	return !((keyPressed !=13) && (keyPressed != 46) && (keyPressed < 48 || keyPressed > 57));
			
}


function addFiles(files,x) {
 	var file = files[0];
	
	var reader = new FileReader();
	
	reader.onload = function (e) {
		var n = e.target.result;
		//console.log(n.length);
		//console.log(x);
		acodificar(n,x);
	};
	reader.readAsDataURL(file);
	
}

function acodificar(im,x){ 
    var i=new Image(); 
    i.onload=function(){ 
        var w=this.width, 
	        h=this.height, 
	        canvas=document.createElement('canvas'), 
	        ctx=canvas.getContext('2d'); 
        //console.log("Ancho " + w + " Largo " + h); 
        var k = 1000;
        var m = (h*k)/w;
        canvas.width=k; 
        canvas.height=m; 
        ctx.drawImage(i,0,0,k,m); 
        var nn = canvas.toDataURL();
        //console.log(nn.length);  
        //console.log("Ancho " + k + " Largo " + m); 
        //console.log(x.id); 
        $("#" + x.id).find("#imagenJuego").attr('src',nn);
        
    };
    i.src=im; 
} 


function eliminarFila(x, nombreTabla, nombreTablaBody){
	var i = x.parentNode.parentNode.rowIndex;
    document.getElementById(nombreTabla.id).deleteRow(i);
    
    contadorFila(nombreTablaBody);
}
